<template>
	<view class="logistics-container page">
		<cu-custom bgColor="bg-white" :isBack="true"><block slot="content">物流详情</block></cu-custom>
		<view v-if="!expressList.courier_num" class='empty'>
		   <view style="margin-top:100rpx;text-align: center">
			   <view class="cuIcon-calendar" style="font-size: 30px;"></view>
			   <view class="text-cut text-lg margin-top-sm">加载中。。。</view>
		   </view>
		</view>
		<view v-else-if="expressList.data.length==0" class='empty'>
		   <view style="margin-top:100rpx;text-align: center">
			   <view class="cuIcon-calendar" style="font-size: 30px;"></view>
			   <view class="text-cut text-lg margin-top-sm">暂无查询到物流信息</view>
		   </view>
		</view>
		<view v-else>
			<view class="cu-list menu-avatar">
				<view class="cu-item">
					<view class="cu-avatar" style="background-color: #fff;">
						<view class="cuIcon-deliver text-theme" style="font-size: 30px;"></view>
					</view>
					<view class="content">
						<view class="text-grey">{{expressList.name}}</view>
						<view class="text-gray text-sm flex">
							<view class="text-cut">
								快递单号：{{expressList.courier_num}}
							</view> </view>
					</view>
				</view>
			</view>
			<view class="cu-timeline" v-for="(item,index) in expressList.data" :key="index">
				<!-- <view class="cu-time">06-17</view> -->
				<view class="cu-item">
					<view class="content">
						<text>{{item.time}}</text> {{item.status}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import * as Order_API from '@/api/order.js'
	export default {
		data() {
			return {
				num:'',
				expressList:[]
			};
		},
		onLoad(e) {
			if(e.ship_no){
				this.num = e.ship_no
				this.getExpressDetail()
			}
		},
		methods:{
			getExpressDetail(){
				let params = {
					num:this.num
				}
				console.log('express',this.num)
				Order_API.getExpress(params).then(res =>{
					this.expressList = res
				})
			}
		}
	}
</script>

<style lang="scss">
.logistics-container{
	background: #fff;
}
</style>
